<html>
<head><meta charset="utf-8"><title>Using visitor inside a test · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html">Using visitor inside a test</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="218217005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217005">(Nov 29 2020 at 15:24)</a>:</h4>
<p>Hi, I wrote a Visitor to check <code>#doc(keyword = "...")]</code> attributes but I don't know how to run it (on libstd only) in a <code>#[test]</code>. Any idea how do it by any chance?</p>



<a name="218217016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217016">(Nov 29 2020 at 15:25)</a>:</h4>
<p><span class="user-mention" data-user-id="210316">@GuillaumeGomez</span> that sounds painful <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> don't you have to set up a tcx and all that?</p>



<a name="218217075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217075">(Nov 29 2020 at 15:26)</a>:</h4>
<p>Yep, that's what I realized afterwards. But having a visitor is very convenient in this case. The alternative would be to just parse libstd in a stupid manner and I'm not really fan of the idea. :3</p>



<a name="218217091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217091">(Nov 29 2020 at 15:27)</a>:</h4>
<p>aren't there internal lints?</p>



<a name="218217092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217092">(Nov 29 2020 at 15:27)</a>:</h4>
<p>I'd go with that instead</p>



<a name="218217152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217152">(Nov 29 2020 at 15:28)</a>:</h4>
<p>Oh, I don't know about that. Anything more concrete? Because if so, I'm gonna use that</p>



<a name="218217175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217175">(Nov 29 2020 at 15:29)</a>:</h4>
<p>there's an example here: <a href="https://github.com/rust-lang/rust/pull/77479">https://github.com/rust-lang/rust/pull/77479</a></p>



<a name="218217300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217300">(Nov 29 2020 at 15:33)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> suggested something I'll try first :)</p>



<a name="218217512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218217512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218217512">(Nov 29 2020 at 15:39)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> He thinks that internal lint is a better idea, so let's go for it. Thanks a lot for the suggestion, I didn't know it was a thing before today :D</p>



<a name="218228051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218228051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218228051">(Nov 29 2020 at 20:06)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span>  Do you know when those lints are run btw? Running <code>x.py build library/std</code> or <code>x.py doc std</code> doesn't seem to run them...</p>



<a name="218228058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218228058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218228058">(Nov 29 2020 at 20:06)</a>:</h4>
<p>not sure, you might have to do a full <code>x.py test</code></p>



<a name="218228156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20visitor%20inside%20a%20test/near/218228156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20visitor.20inside.20a.20test.html#218228156">(Nov 29 2020 at 20:09)</a>:</h4>
<p>Ok, let's give it a try then!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>